// /platform/workspace/list
import request from '@/utils/request';

const reportIndexApi = {};

reportIndexApi.markdownToHtml = (params) => {
	return request({
		url: '/platform-api/report/md2html',
		method: 'post',
		data: params
	})
}
reportIndexApi.getThymeleafData = (templateFormId, hasOrganism) => {
	return request({
		url: '/platform-api/report/data/' + templateFormId + '?hasOrganism=' + hasOrganism,
		method: 'get',
	})
}

reportIndexApi.genePdf = (templateId, showTemplate, sampleReportId, geneCoverContent) => {
  let url = '/platform-api/report/gene-pdf?templateId=' + templateId + '&sampleReportId=' + sampleReportId + '&showTemplate=' + showTemplate + '&geneCoverContent=' + geneCoverContent;
  if (!sampleReportId) {
    url = '/platform-api/report/gene-pdf?templateId=' + templateId + '&showTemplate=' + showTemplate + '&geneCoverContent=' + geneCoverContent;
  }
	return request({
		url: url,
		method: 'get',
		responseType: "blob",
	})
}

reportIndexApi.pdfDownload = (templateId) => {
	return request({
		url: '/platform-api/report/download-pdf?templateId=' + templateId,
		method: 'get',
		responseType: "blob",
	})
}
reportIndexApi.parseReport = (params) => {
	return request({
		url: '/platform-api/report/parse',
		method: 'post',
		data: params
	})
}

export default reportIndexApi